package net.entelijan.cobean.bind;

import java.util.Collection;
import java.util.List;

/**
 * Keeps all binding implementation details away from the core.
 * TODO Write Comments for the methods
 */
public interface IPropertyBindingStrategy {

    public abstract <T, C> T bind(T model, IBinding<C> propertyBinding, C comp);

    public abstract <C> IItemWrapper createItemWrapper(Object obj,
            List<IColumnBinding<C>> itemBindings);

    public <C> IColumn createColumn(IColumnBinding<C> columnBinding);

    /**
     * Binds the elements of a collection.
     * Make sure no model change events are triggert during binding. That might
     * result in an endless loop.
     * 
     * @param <C> The component
     * @param coll The collection witch elements might be bound 
     * @param columnBindings The column bindings
     * @param comp The component to witch the collection items are bound
     */
    public <C> void bindColumns(Collection<Object> coll, List<IColumnBinding<C>> columnBindings,
            C comp);

    public <T> IBeanProperty createBeanProperty(T model, String modelProperty);

    public abstract List<IColumnBinding<? extends Object>> getBeanBasedColumnBindings(Class<?> clazz);

}